/**
 * BlackTeaResponse.java
 * com.tc.client.blacktea.api
 *
 * Function： TODO 
 *
 *   ver     date      		author
 * ──────────────────────────────────
 *   		 2012-7-3 		wangjieming
 *
 * Copyright (c) 2012, TNT All Rights Reserved.
 */

package com.jamin.aabill.api;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.jamin.aabill.http.Response;



/**
 * ClassName:BlackTeaResponse
 *
 * @author   wangjieming
 * @version  1.0
 * @since    v1.0
 * @Date	 2012-7-3 上午11:35:20 
 */
public class BillResponse extends JsonResponse{


	
	protected RequestStatus requestStatus = new RequestStatus(new JSONObject());
	protected RequestPageInfo requestPageInfo = new RequestPageInfo(new JSONObject());
	protected Object requestBizObject = null;

	public BillResponse(){
		
	}
	

	public BillResponse(Response res , int type) throws BillException{
		requestStatus = new RequestStatus(res.asJSONObject());
		requestPageInfo = new RequestPageInfo(res.asJSONObject());
		try {
			switch(type){
			case BillApi.TYPE_JSONOBJECT:
				requestBizObject = res.asJSONObject().getJSONObject("bizobj");
				break;
			case BillApi.TYPE_JSONARRAY:
				requestBizObject = res.asJSONObject().getJSONArray("bizobj");
				break;
			}
		} catch (JSONException e) {
			switch(type){
			case BillApi.TYPE_JSONOBJECT:
				requestBizObject = new JSONObject();
				break;
			case BillApi.TYPE_JSONARRAY:
				requestBizObject = new JSONArray();
				break;
			}
		}
	}

	public RequestStatus getRequestStatus() {
		return requestStatus;
	}

	public void setRequestStatus(RequestStatus requestStatus) {
		this.requestStatus = requestStatus;
	}

	public RequestPageInfo getRequestPageInfo() {
		return requestPageInfo;
	}

	public void setRequestPageInfo(RequestPageInfo requestPageInfo) {
		this.requestPageInfo = requestPageInfo;
	}

	public Object getRequestBizObject() {
		return requestBizObject;
	}
	public void setRequestBizObject(JSONObject requestBizObject) {
		this.requestBizObject = requestBizObject;
	}










}

